package link.anyauto.dtbinding.widgets;

import android.databinding.DataBindingUtil;

import link.anyauto.dtbinding.R;
import link.anyauto.dtbinding.base.ActBase;
import link.anyauto.dtbinding.databinding.ActWidgetsBinding;

/**
 * Created by Administrator on 2016/7/26.
 */
public class ActWidgets extends ActBase {

    @Override
    protected void setupBinding() {
        binding = DataBindingUtil.setContentView(this, R.layout.act_widgets);
    }

    @Override
    protected void setupVM() {
        vm = new WidgetsVM();

        Item item = new Item();
        item.label = "百度";
        item.value = "https://www.baidu.com/img/bd_logo1.png";
        vm.items.add(item);

        item = new Item();
        item.label = "京东";
        item.value = "http://www.jd.com/favicon.ico";
        vm.items.add(item);

        item = new Item();
        item.label = "阿里巴巴";
        item.value = "http://www.alibaba.com/favicon.ico";
        vm.items.add(item);
    }

    @Override
    protected void setupHandlers() {
        handlers = new WidgetsHandlers();
    }

    @Override
    protected void justAfterSetup() {
        handlers.vm = vm;
        binding.setVm(vm);
        binding.setHandlers(handlers);
    }

    ActWidgetsBinding binding;
    WidgetsVM vm;
    WidgetsHandlers handlers;
}
